﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data.SqlTypes;

namespace WindowsFormsApplication1
{
    public partial class Return_popup : Form
    {
        public Return_popup()
        {
            InitializeComponent();
        }

        private void Return_popup_Load(object sender, EventArgs e)
        {
            try
            {
                DateTime d = DateTime.Parse(new Midval().getDisDate());

                String getDis = "SELECT recno,item,i.itemname as n FROM returnx d,Items i WHERE  d.datex BETWEEN '" + d.ToString("yyyy-MM-dd") + "' AND '" + d.AddDays(1).ToString("yyyy-MM-dd") + "'  AND i.Itemcode=d.item";
                SqlDataReader disdr = DbConnet.ReadTable(getDis);

                while (disdr.Read())
                {
                    String val = disdr["Recno"].ToString() + " - " + disdr["n"].ToString();
                    listBox1.Items.Add(val);
                }
                disdr.Close();
            }
            catch (Exception exld)
            {
            }
        }

        private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            try
            {
                String val = listBox1.SelectedItem.ToString();
                new Midval().setRecCode(val);
                this.Hide();
            }
            catch
            {
            }
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.Hide();
        }
    }
}
